file(GLOB_RECURSE examples_srcs
     RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cu")

foreach(source_filename ${examples_srcs})
  # retrieve the names
  get_filename_component(source_dir ${source_filename} PATH)
  get_filename_component(executable_name ${source_filename} NAME_WE)
  set(target_name "examples_${source_dir}_${executable_name}")
  # create dirs
  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${source_dir})
  # add executable
  CUDA_ADD_EXECUTABLE(${target_name} ${source_filename})
  set_target_properties(${target_name}
                        PROPERTIES OUTPUT_NAME
                                   ${source_dir}/${executable_name})
endforeach(source_filename)

